<?php
/* @var $this GiftPasswordController */
/* @var $model GiftPassword */
/* @var $form CActiveForm */
?>

<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'gift-password-form',
	'enableAjaxValidation'=>false,
)); 

$pass = $_GET['pass'];
$sate = $_GET['state'];
$expire_date=$_GET['expire_date'];
if($sate == 2){
?>
	<p class="red"> <?php echo Yii::t('base','Winner,Unclaimed,Expired');?> </p>
<?php }elseif($sate == 4){?>
	<p class="red"> <?php echo Yii::t('base','This code has expired on ').$expire_date;?> </p>
<?php }elseif($sate == 5){?>
	<p class="red"> <?php echo Yii::t('base','Receiving Password does not exist or has been received');?> </p>
<?php }elseif($sate == 3){ ?>
	<p class="red"> <?php echo Yii::t('base','Winner,To accept the award');?> </p>
<?php }elseif($sate == 6){?>
	<p class="red"> <?php //echo Yii::t('base','Password exists, you can receive'); ?> </p>
<?php 
	$sql="select * from zy_gift_password where password='".$pass."'";
	$rs = yii::app()->db->createCommand($sql)->queryAll();
} ?>

	<p class="note"><?php echo Yii::t('base','Fields with <span class="required">*</span> are required.');?></p>

	<?php echo $form->errorSummary($model); ?>
	<div class="row">
		<?php echo $form->labelEx($model,Yii::t('base','Award Code')); ?>
		<?php echo $form->TextField($model,'password',array('size'=>50,'maxlength'=>50,'value'=>$pass)); ?>
		<?php echo $form->error($model,'password'); ?>
	</div>
	<div class="row">
	<?php if($sate == 6){ ?>
		<?php echo $form->labelEx($model,'Device Serial Number'); ?>
		<INPUT type="text" name="GiftPassword[service_number]" id="GiftPassword_service_number" value="<?php echo $rs[0]['service_number']; ?>" />
	<?php  } ?>
	</div>
	
	<div class="row buttons">
		<?php 
		if($sate == 6){
		echo CHtml::submitButton($model->isNewRecord ? Yii::t('base','To accept the award') : Yii::t('base','Save')); 
		}else{
			echo CHtml::submitButton($model->isNewRecord ? Yii::t('base','Verify') : Yii::t('base','Save'));
		}
		
		?>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->